﻿using AutoMapper.Configuration;
using Microsoft.Extensions.Configuration;
using SqlSugar;
using System;
using System.Net.Http;
using System.Threading.Tasks;
using static System.Net.WebRequestMethods;
using IConfiguration = Microsoft.Extensions.Configuration.IConfiguration;

namespace VOL.WebApi
{
    public class ERPAPI
    {
        private readonly IHttpClientFactory _httpClientFactory;

        public ERPAPI(IHttpClientFactory httpClientFactory)
        {
            _httpClientFactory = httpClientFactory;
        }

        public async Task<string> GetData()
        {
            //TODO: Implement the GetData method}
            //appseting.json读这个URL
            var url = "http://localhost:5204";
            var client = _httpClientFactory.CreateClient();
            client.BaseAddress = new Uri(url);
            var response = await client.GetStringAsync("/WeatherForecast");
            //反列化成对象 存储到数据库
            Console.WriteLine(response);
            return response;
        }
    }
}
